home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / VBSamples / Demos / AirHockey / frmAudio.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-10-08  |  5.5 KB  |  163 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.Form frmAudio 
  4.    BorderStyle     =   4  'Fixed ToolWindow
  5.    Caption         =   "Audio Options"
  6.    ClientHeight    =   3360
  7.    ClientLeft      =   45
  8.    ClientTop       =   285
  9.    ClientWidth     =   6405
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   3360
  14.    ScaleWidth      =   6405
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   1  'CenterOwner
  17.    Begin VB.CommandButton cmdOk 
  18.       Caption         =   "OK"
  19.       Default         =   -1  'True
  20.       Height          =   375
  21.       Left            =   5340
  22.       TabIndex        =   0
  23.       Top             =   2880
  24.       Width           =   975
  25.    End
  26.    Begin VB.CommandButton cmdCancel 
  27.       Cancel          =   -1  'True
  28.       Caption         =   "Cancel"
  29.       Height          =   375
  30.       Left            =   4260
  31.       TabIndex        =   5
  32.       Top             =   2880
  33.       Width           =   975
  34.    End
  35.    Begin VB.Frame Frame1 
  36.       Caption         =   "Audio details"
  37.       Height          =   2655
  38.       Left            =   60
  39.       TabIndex        =   6
  40.       Top             =   120
  41.       Width           =   6255
  42.       Begin MSComctlLib.Slider sldVolume 
  43.          Height          =   255
  44.          Left            =   120
  45.          TabIndex        =   2
  46.          Top             =   1140
  47.          Width           =   6075
  48.          _ExtentX        =   10716
  49.          _ExtentY        =   450
  50.          _Version        =   393216
  51.          LargeChange     =   10
  52.          SmallChange     =   5
  53.          Min             =   -100
  54.          Max             =   0
  55.          TickFrequency   =   10
  56.       End
  57.       Begin VB.CheckBox chkMusic 
  58.          Caption         =   "Play Background Music"
  59.          Height          =   255
  60.          Left            =   120
  61.          TabIndex        =   3
  62.          Top             =   1500
  63.          Width           =   5955
  64.       End
  65.       Begin VB.CheckBox chkPlaySounds 
  66.          Caption         =   "Play Sounds"
  67.          Height          =   255
  68.          Left            =   120
  69.          TabIndex        =   1
  70.          Top             =   540
  71.          Width           =   5955
  72.       End
  73.       Begin MSComctlLib.Slider sldMusic 
  74.          Height          =   255
  75.          Left            =   60
  76.          TabIndex        =   4
  77.          Top             =   2100
  78.          Width           =   6075
  79.          _ExtentX        =   10716
  80.          _ExtentY        =   450
  81.          _Version        =   393216
  82.          LargeChange     =   10
  83.          SmallChange     =   5
  84.          Min             =   -100
  85.          Max             =   0
  86.          TickFrequency   =   10
  87.       End
  88.       Begin VB.Label lblMusic 
  89.          BackStyle       =   0  'Transparent
  90.          Caption         =   "Volume of background music"
  91.          Height          =   255
  92.          Left            =   120
  93.          TabIndex        =   9
  94.          Top             =   1800
  95.          Width           =   3855
  96.       End
  97.       Begin VB.Label lblSound 
  98.          BackStyle       =   0  'Transparent
  99.          Caption         =   "Volume of ambient sounds (puck, scoring, etc)"
  100.          Height          =   255
  101.          Left            =   180
  102.          TabIndex        =   8
  103.          Top             =   840
  104.          Width           =   3855
  105.       End
  106.       Begin VB.Label Label2 
  107.          BackStyle       =   0  'Transparent
  108.          Caption         =   "Here you can control the few audio settings."
  109.          Height          =   255
  110.          Index           =   0
  111.          Left            =   120
  112.          TabIndex        =   7
  113.          Top             =   240
  114.          Width           =   6015
  115.       End
  116.    End
  117. Attribute VB_Name = "frmAudio"
  118. Attribute VB_GlobalNameSpace = False
  119. Attribute VB_Creatable = False
  120. Attribute VB_PredeclaredId = True
  121. Attribute VB_Exposed = False
  122. Option Explicit
  123. Private Sub chkMusic_Click()
  124.     sldMusic.Enabled = (chkMusic.Value = vbChecked)
  125.     lblMusic.Enabled = (chkMusic.Value = vbChecked)
  126. End Sub
  127. Private Sub chkPlaySounds_Click()
  128.     sldVolume.Enabled = (chkPlaySounds.Value = vbChecked)
  129.     lblSound.Enabled = (chkPlaySounds.Value = vbChecked)
  130. End Sub
  131. Private Sub cmdCancel_Click()
  132.     Unload Me
  133. End Sub
  134. Private Sub cmdOk_Click()
  135.     SaveAudioSettings
  136.     Unload Me
  137. End Sub
  138. Private Sub Form_Load()
  139.     'Now update the display
  140.     chkMusic.Value = Abs(goAudio.PlayMusic)
  141.     chkPlaySounds.Value = Abs(goAudio.PlaySounds)
  142.     sldVolume.Value = goAudio.SoundVolume / 25
  143.     sldMusic.Value = goAudio.MusicVolume / 25
  144.     'Update the UI
  145.     sldMusic.Enabled = (chkMusic.Value = vbChecked)
  146.     lblMusic.Enabled = (chkMusic.Value = vbChecked)
  147.     sldVolume.Enabled = (chkPlaySounds.Value = vbChecked)
  148.     lblSound.Enabled = (chkPlaySounds.Value = vbChecked)
  149. End Sub
  150. Private Sub SaveAudioSettings()
  151.     goAudio.PlayMusic = (chkMusic.Value = vbChecked)
  152.     goAudio.PlaySounds = (chkPlaySounds.Value = vbChecked)
  153.     goAudio.MusicVolume = sldMusic.Value * 25
  154.     goAudio.SoundVolume = sldVolume.Value * 25
  155. End Sub
  156. Private Sub Form_Unload(Cancel As Integer)
  157.     'We're leaving the form, save the settings
  158.     SaveSetting gsKeyName, gsSubKeyAudio, "UseBackgroundMusic", goAudio.PlayMusic
  159.     SaveSetting gsKeyName, gsSubKeyAudio, "UseSound", goAudio.PlaySounds
  160.     SaveSetting gsKeyName, gsSubKeyAudio, "MusicVolume", goAudio.MusicVolume
  161.     SaveSetting gsKeyName, gsSubKeyAudio, "SoundVolume", goAudio.SoundVolume
  162. End Sub
  163.